<html><head><title>File.pb</title></head>
<body bgcolor="#EFF1F0" link="#3A3966" vlink="#000000" alink="#000000">
<pre><font face="Courier New, Courier, mono"size="2"><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font><font color="#3A3966">;   PureBasic - File example file
</font><font color="#3A3966">;
</font><font color="#3A3966">;    (c) Fantaisie Software
</font><font color="#3A3966">;
</font><font color="#3A3966">; ------------------------------------------------------------
</font><font color="#3A3966">;
</font>
<font color="#3A3966">MessageRequester</font>(&quot;PureBasic&quot;, &quot;Welcome !&quot;+<font color="#3A3966">Chr</font>(13)+&quot;PureBasic will write a file named: PureBasicTestFile.pb&quot;, 0)

<b><font color="#3A3966">If</font></b> <font color="#3A3966">CreateFile</font>(0, &quot;PureBasicTestFile.txt&quot;)
<font color="#3A3966">  WriteStringN</font>(0, &quot;         This is a PureBasic file test&quot;)
<font color="#3A3966">  WriteString</font>(0, &quot;Now it's on &quot;)
<font color="#3A3966">  WriteString</font>(0, &quot;the same line.&quot;)

<font color="#3A3966">  CloseFile</font>(0)
<b><font color="#3A3966">Else</font></b>
<font color="#3A3966">  MessageRequester</font>(&quot;PureBasic&quot;, &quot;Error: can't write the file&quot;, 0)
  <b><font color="#3A3966">End</font></b>
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">If</font></b> <font color="#3A3966">ReadFile</font>(0, &quot;PureBasicTestFile.txt&quot;)

  First$ =<font color="#3A3966">  Trim</font>(<font color="#3A3966">ReadString</font>(0))
<font color="#3A3966">  MessageRequester</font>(&quot;PureBasic&quot;, &quot;Line read: &quot;+First$, 0)
  
<font color="#3A3966">  CloseFile</font>(0)
<b><font color="#3A3966">Else</font></b>
<font color="#3A3966">  MessageRequester</font>(&quot;PureBasic&quot;, &quot;Error: Can't read the file&quot;, 0)
<b><font color="#3A3966">EndIf</font></b>

<b><font color="#3A3966">End</font></b>
</font></pre>
</body></html>
